(module io mzscheme
  (provide save-sexpr
           read-sexpr
           load-sexpr)
  
  (require (lib "defmacro.ss"))
  
  (define (save-sexpr sexpr file)
    "save-sexpr takes a sexpr argument and a file argument and writes that sexpr to that file."
    (with-output-to-file file
      (lambda ()
        (write sexpr))
      'replace))
  
  (define (read-sexpr file)
    "read-log takes a file argument and reads a sexpr from that file."
    (with-input-from-file file
      (lambda ()
        (read))))
  
  (define-macro load-sexpr
    (lambda (target type)
      (cond ((eq? type 'log)
             `(set! ,target (read-sexpr "log.srl")))
            ((eq? type 'course)
             `(set! ,target (read-sexpr "course.srl")))))))